#ifndef LBOOK_PLUGIN_INTERFACE_HPP
#define LBOOK_PLUGIN_INTERFACE_HPP

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_DragSelector.H>
#include <FL/Fl_Value_Slider.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Image.H>
#include <FL/Fl_Bitmap.H>
#include <nano-X.h>
#include <nxcolors.h>

typedef struct{
    GR_WINDOW_ID apollo_wid;
    GR_GC_ID gc;
    GR_FONT_ID fontid;
}Apollo_State;

extern Apollo_State state;

void init_apollo();

#ifdef __cplusplus
extern "C" {
#endif

    // ------------------------------------------------------
    // Structures
    // ------------------------------------------------------
    struct status_info_t 
    {
        int bookmarkLabelFlags;
        int musicState;	
        int batteryState;    
        int currentBookmarkFlags; 
    };

    struct myRECT 
    {
	int x;
	int y;
	int width;
	int height;
    };

    struct viewer_menu_item_t 
    {
        int actionId;  /*!< item action code. 0 to mark end of array. 
                         For submenu, it can be used to allow removing 
                         standard submenu item from root level.
                       */
        const char * captionLabelId;/*!< key string to find menu item 
                                      label in language file, NULL to 
                                      remove standard item with this 
                                      actionId
                                    */
        viewer_menu_item_t * submenu; /*!< pointer to submenu items array, 
                                        if any. Null for final item. If 
                                        submenu is specified, 
                                        submenu should be shown on item 
                                        press, instead of calling 
                                        OnMenuAction( int actionId )
                                      */
	//Submenu not be supported currently
    };

    // ------------------------------------------------------
    // Functions
    // ------------------------------------------------------
#ifdef NANO_X
    void vSetDisplayState(Apollo_State *);

#endif
    int  IsStandardStatusBarVisible();
    void SetCallbackFunction(struct CallbackFunction *cb);
    void vEndDoc();
    int  InitDoc(char*);
    int  iInitDocF(char *, int, int);
    int  iGetDocPageWidth();
    int  iGetDocPageHeight();
    int  bGetRotate();
    void vSetCurPage(int);
    int  GetPageNum();
    void vGetTotalPage(int *a);
    int  GotoPage(int index);
    int  GetPageIndex();
    
//
// Need to be implemented
//
    void GetPageData(void **data);
    void vSetRotate(int);

    int Bigger();
    int Smaller();
    int Rotate();
    int Fit();
    int Prev();
    int Next();

    int Origin();
    void Release();
    void GetPageDimension(int *width, int *height);
    void SetPageDimension(int width, int height);
    void SetPageDimension_l(int width, int height);
    double dGetResizePro();
    void vSetResizePro(double dSetPro);

    void bGetUserData(void **vUserData, int *iUserDataLength);
    void vSetUserData(void *vUserData, int iUserDataLength);
    
    unsigned short usGetLeftBarFlag();
    void   vEndInit(int iEndStyle);
    void   vFirstBmp(char *, int);
    int       iGetCurDirPage(int, int);
    int       iGetDirNumber();
    unsigned short* usGetCurDirName(int, int);
    int       iGetCurDirLen(int, int);
    void   vClearAllDirList();
    int   bCurItemIsLeaf(int pos);
    void   vEnterChildDir(int pos);
    void   vReturnParentDir();
    void   vFreeDir();
    int OnKeyPressed(int keyId, int state);
    int OnMenuAction( int actionId );
    
    const viewer_menu_item_t * GetCustomViewerMenu();
    const char * GetCurrentPositionBookmark();
    void GoToBookmark( const char * bookmark );
    int GetBookmarkPage( const char * bookmark );

    int OnStatusInfoChange( status_info_t* statusInfo,
                            myRECT*        rectToUpdate );

    const char * GetAboutInfoText();
    unsigned short * szGetVoiceDataBlock( int  iPage, 
                                          int* numChars, 
                                          int* encodingType );
    int getBatteryState();
    void setStatusMode( int newMode );
    int EndMenuDialogState( int option );
    void enableBookmarkIcons( bool enable );
    void vFontBigger();
    int	iCreateDirList();
    unsigned short* usGetCurDirNameAndLen(int pos, int * len);
    int OpenLeaf( int pos );

#ifdef __cplusplus

}

#endif


#endif //LBOOK_PLUGIN_INTERFACE_HPP
